<template>
<uni-shadow-root class="view-new-aikucun-measure_card2"><template name="measure_card2"> 

<view class="measure_card" @touchmove.stop.prevent="true" v-if="showCount">
  <view class="countContainer"> 
     <view class="countContainer_top">
        <view class="countContainer_top_image">
          <image mode="aspectFill" :data-url="focusData.imagePath" :data-urls="focusData.imageListWatcher" @click="_watchBigImage" :src="focusData.imagePath"></image>
        </view>
        <view class="countContainer_top_product_info_container">
           <view class="font_1">{{focusData.name}}</view>
           <view class="font_aaa font_08">商品编号: {{focusData.orderNumber}}</view>
           <view class="price font_14" v-if="measures.length == 0||!measures">
             <text v-if="focusData.promotion>0&&type!='pintuanOne'">￥{{focusData.promotionPrice}}</text>
             <text v-else>￥{{focusData.price}}</text>
           </view>
           <view class="price font_14 price_group" v-else>
              <view class="pintuan" v-if="focusData.promotionBean&&focusData.promotionBean.pintuanStrategy&&(type=='pintuanMore'||type=='addPintuan')">
                <text class="show_price" v-if="measurementJson.promotionPrice">￥{{measurementJson.promotionPrice}}</text>
                <text class="loading_price" v-else>￥{{measurementJson.price}}</text>
              </view>
              <view class="noPintuan" v-else>￥{{measurementJson.price}}</view>
              <text class="tagPrice_font" v-if="measurementJson.price<measurementJson.tagPrice">￥{{measurementJson.tagPrice}}</text>
              <text style="color:#aaa;font-size:24rpx;margin-left:8rpx;" v-if="(measures.length == 0||!measures)&&focusData.stock<=10">(仅剩：{{focusData.stock}})</text>
              <text style="color:#aaa;font-size:24rpx;margin-left:8rpx" v-if="(measures.length != 0&&measures)&&measurementJson.stock<=10">(仅剩：{{measurementJson.stock}})</text>
           </view>
           
        </view>
     </view>
    <view class="measureItemContainer">
        <view v-for="(types,index) in (measures)" :key="types.index" class="cardMid">
          <view class="cardMidName">{{types.name}}</view>
          <radio-group class="cardMidGuigeContainer" :name="types.name" @change="chooseMeasure">
            <label v-for="(Measure,i) in (types.productAssignMeasure)" :key="Measure.i" class="font_08" :data-index="(index)+'-'+(i)" @click.stop.prevent="radioChange" :data-value="Measure.measureName" :data-type="types.name">
              <view :class="types.checkedMeasureItem == i? "activeMeasure":""" :style="'background:'+(types.checkedMeasureItem == i? setting.platformSetting.defaultColor:"")+';color:'+(types.checkedMeasureItem == i? "#fff":setting.platformSetting.defaultColor)">{{Measure.measureName}}</view>
              <radio :checked="types.checkedMeasureItem == i" :value="(Measure.measureTypeName)+'-'+(Measure.id)" hidden="true"></radio>
            </label>
          </radio-group>
        </view>
      </view>
      <view class="error_view font_08" :style="'background:'+(setting.platformSetting.defaultColor)" v-if="measurementJson.stock < byNowParams.itemCount">
        <text>库存不足:(</text>
        <text v-for="(mtype,index) in (measurementJson.measurements)">-{{mtype.measureName}}</text>
        
        <text>)剩余库存【{{measurementJson.stock}}】</text>
      </view>

      <view class="ItemCountDell">
        <view class="font_777 font_09">购买数量</view>
        

          <view class="item_infomation_nums"> 
            <image style="border-top-left-radius: 0.2em;border-bottom-left-radius: 0.2em;" src="https://image1.sansancloud.com/xianhua/2019_12/17/21/40/33_565.jpg?x-oss-process=style/preview_120" :class="byNowParams.itemCount == minCount ?"noadd":""" @click.stop.prevent="subNum"></image>
            <text class="flexCenter">{{byNowParams.itemCount}}</text>
            <image style="border-top-right-radius: 0.2em; border-bottom-right-radius: 0.2em;" src="https://image1.sansancloud.com/xianhua/2019_12/17/21/40/33_660.jpg?x-oss-process=style/preview_120" :class="byNowParams.itemCount > measurementJson.stock?"noadd":""" :data-cantadd="(byNowParams.itemCount > measurementJson.stock?1:0)+' '" @click.stop.prevent="addNum"></image>
          </view>
      </view>
      <button v-if="type !== 'select'" :style="'background:'+(setting.platformSetting.defaultColor)" class="sureButn" :disabled="byNowParams.itemCount > measurementJson.stock||!measurementJson.waitDataState" @click="buyNow">确定</button>
      <view class="selectType" v-if="type == 'select'">
          <button :style="'background:'+(setting.platformSetting.defaultColor)" class="sureButnType" :disabled="byNowParams.itemCount > measurementJson.stock" data-way="cart" @click="buyNow">加入购物车</button>
          <button :style="'background:'+(setting.platformSetting.defaultColor)" class="sureButnType" :disabled="byNowParams.itemCount > measurementJson.stock" data-way="buy" @click="buyNow">立即购买</button>
      </view>

  </view>

  <view class="zhezhao" v-if="showCount" @click="closeZhezhao"></view>
</view>
</template></uni-shadow-root>
</template>
<wxs src="../../public/publicFun.wxs" module="publicFun"></wxs>
<script>

global['__wxRoute'] = 'view-new/aikucun/measure_card2'

Component({})

export default global['__wxComponents']['view-new/aikucun/measure_card2']
</script>
<style platform="mp-weixin">

</style>